package com.itestor.iptv.modules.common.domain;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "QOSRECORD")
public class QosRecord {

    private Long idQosRecord;

    private Integer idRobot;

    private Long logTime;

    private String srcIp;

    private Integer srcPort;

    private String destIp;

    private Integer destPort;

    private Integer rtplost;

    private Integer rtpse;

    private Float df;

    private Long mdimlr;

    private Long bitRate;

    private Float portBitRate;

    private Float volume;

    private Long power;

    @Id
    @GeneratedValue
    @Column(name = "IDQOSRECORD")
    public Long getIdQosRecord() {
        return idQosRecord;
    }

    public void setIdQosRecord(Long pIdQosRecord) {
        idQosRecord = pIdQosRecord;
    }

    @Column(name = "IDROBOT", nullable = false)
    public Integer getIdRobot() {
        return idRobot;
    }

    public void setIdRobot(Integer pIdRobot) {
        idRobot = pIdRobot;
    }

    @Column(name = "LOGTIME", nullable = false)
    public Long getLogTime() {
        return logTime;
    }

    public void setLogTime(Long pLogTime) {
        logTime = pLogTime;
    }

    @Column(name = "SRCIP", nullable = false, length = 20)
    public String getSrcIp() {
        return srcIp;
    }

    public void setSrcIp(String pSrcIp) {
        srcIp = pSrcIp;
    }

    @Column(name = "SRCPORT", nullable = false)
    public Integer getSrcPort() {
        return srcPort;
    }

    public void setSrcPort(Integer pSrcPort) {
        srcPort = pSrcPort;
    }

    @Column(name = "DESTIP", nullable = false, length = 20)
    public String getDestIp() {
        return destIp;
    }

    public void setDestIp(String pDestIp) {
        destIp = pDestIp;
    }

    @Column(name = "DESTPORT", nullable = false)
    public Integer getDestPort() {
        return destPort;
    }

    public void setDestPort(Integer pDestPort) {
        destPort = pDestPort;
    }

    @Column(name = "RTPLOST")
    public Integer getRtplost() {
        return rtplost;
    }

    public void setRtplost(Integer pRtplost) {
        rtplost = pRtplost;
    }

    @Column(name = "RTPSE")
    public Integer getRtpse() {
        return rtpse;
    }

    public void setRtpse(Integer pRtpse) {
        rtpse = pRtpse;
    }

    @Column(name = "DF")
    public Float getDf() {
        return df;
    }

    public void setDf(Float pDf) {
        df = pDf;
    }

    @Column(name = "MDIMLR")
    public Long getMdimlr() {
        return mdimlr;
    }

    public void setMdimlr(Long pMdimlr) {
        mdimlr = pMdimlr;
    }

    @Column(name = "BITRATE")
    public Long getBitRate() {
        return bitRate;
    }

    public void setBitRate(Long pBitRate) {
        bitRate = pBitRate;
    }

    @Column(name = "PORTBITRATE")
    public Float getPortBitRate() {
        return portBitRate;
    }

    public void setPortBitRate(Float pPortBitRate) {
        portBitRate = pPortBitRate;
    }

    @Column(name = "VOLUME")
    public Float getVolume() {
        return volume;
    }

    public void setVolume(Float pVolume) {
        volume = pVolume;
    }

    @Column(name = "POWER")
    public Long getPower() {
        return power;
    }

    public void setPower(Long pPower) {
        power = pPower;
    }
    
    /**
     * get LogTime.String
     * @return String 
     */
    @Transient
    public String getLogTimeStr() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm",
                Locale.US);
        return sdf.format(new Date(logTime * 1000L));
    }
}
